<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>商品列表</title>
<!-- css 样式引入 -->
<link rel="stylesheet" type="text/css"
	href="../../css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css"
	href="../../css/bootstrap-table.css" />
<link rel="stylesheet" type="text/css"
	href="../../css/bootstrap-datetimepicker.min.css" />
<link rel="stylesheet" type="text/css"
	href="../../css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="../../css/index.css">
<!-- js引入 -->
<script type="text/javascript" src="../../js/jquery.min.js"></script>
<script type="text/javascript" src="../../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../js/bootstrap-table.js"></script>
<script type="text/javascript" src="../../js/bootstrap-table-zh-CN.js"></script>
<script type="text/javascript" src="../../js/bootstrap-datetimepicker.js"></script>
<script src="js/commodityList.js"></script>

</head>

<body>
	<!-- 标题 -->
	<table class="btbHead">
		<tr>
			<td style="width: 25%;"><i class="fa fa-align-justify"></i>&nbsp;商品列表</td>
			<td style="text-align: right;"><a href="#" id="addBtn"
				class="btn btn-info" data-toggle="modal" data-target="#addModal"><i
					class="fa fa-plus"></i>&nbsp;添加</a></td>
		</tr>
	</table>

	<!-- 模糊查询条件 -->
	<form role="form" class="form-inline searchForm">
		<div class="form-group">
			<label for="name">查询条件</label> <input type="text"
				class="form-control" id="keyWord" placeholder="请输入商品编号"
				style="width: 250px;"> <a href="javascript:doQuery()"
				class="btn btn-default"><i class="fa fa-search"></i></a>
		</div>
	</form>

	<div class="slideLine" style="margin-top: 10px; margin-bottom: 10px;"></div>

	<!-- 数据表格 -->
	<table data-toggle="table" id="dataTable" data-pagination="true">
		<thead>
			<tr>
				<th data-field="id" data-align="center">商品编号</th>
				<th data-field="goodsName" data-align="left" data-width="10%">商品名称</th>
				<th data-field="characterDesc" data-align="left" data-width="20%">商品特色</th>
				<th data-field="images" data-formatter="formatImg" data-width="10%">图片</th>
				<th data-field="state" data-formatter="stateFormatter"
					data-width="5%">商品状态</th>
				<th data-field="weight" data-width="5%">重量</th>
				<th data-field="stock" data-width="5%">库存</th>
				<th data-field="price" data-align="center" data-width="6%">商品单价</th>
				<th data-field="marketPrice" data-align="center" data-width="7%">市场价</th>
				<th data-field="upTime" data-formatter="dateFormatter"
					data-width="10%">上架时间</th>
				<th data-field="opraite" data-formatter="operateFormatter"
					data-width="10%">操作</th>
			</tr>
		</thead>
	</table>

	<!--修改模态框-->
	<div class="modal fade" id="modifyModal" tabindex="-1" role="dialog"
		aria-labelledby="modifyModalLabel" aria-hidden="true">
		<div class="modal-dialog" style="width: 900px;">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">修改商品信息</h4>
				</div>
				<div class="modal-body" id="iptBox">
					<form class="form-horizontal form-inline commitForm"
						id="modifyForm" role="form">
						<table width="100%">
							<tr>
								<td style="text-align: right; width: 12%;"><span>商品编号</span>
								</td>
								<td><input id="m_goodsId" class="form-control" name="id"
									type="text" style="width: 100%" value="" readonly="true"></td>
								<td style="text-align: right; width: 12%;">商品名称</td>
								<td><input id="m_goodsName" class="form-control"
									name="goodsName" type="text" value="" style="width: 100%"></td>
								<td style="text-align: right; width: 12%;">商品特色</td>
								<td><input id="m_characterDesc" class="form-control"
									name="characterDesc" type="text" value="" style="width: 100%"></td>
							</tr>
							<tr>
								<td style="text-align: right; width:;"><span>商品状态</span></td>
								<td><select id="m_state" class="form-control" name="state"
									style="width: 100%">
										<option value="0">草稿</option>
										<option value="1">正常</option>
										<option value="2">上架</option>
										<option value="3">缺货</option>
										<option value="4">停售</option>
										<option value="5">删除</option>
								</select></td>
								<td style="text-align: right;"><span>商品库存</span></td>
								<td colspan=""><input id="m_stock" class="form-control"
									name="stock" type="text" value="" style="width: 100%">
								</td>
								<td style="text-align: right;"><span>商品单价</span></td>
								<td colspan=""><input id="m_price" class="form-control"
									name="price" type="text" value="" style="width: 100%">
								</td>
							</tr>
							<tr>
								<td style="text-align: right;"><span>商品市场价</span></td>
								<td colspan=""><input id="m_marketPrice"
									class="form-control" name="marketPrice" type="text" value=""
									style="width: 100%"></td>

								<td style="text-align: right;"><span>商品重量</span></td>
								<td colspan=""><input id="m_weight" class="form-control"
									name="weight" type="text" value="" style="width: 100%">
								</td>
							</tr>
						</table>
					</form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">取消
					</button>
					<button type="button" class="btn btn-primary" id="btnSave"
						onclick="modify()">确定</button>
				</div>
			</div>
		</div>
	</div>

	<!--增加模态框-->
	<div class="modal fade" id="addModal" tabindex="-1" role="dialog"
		aria-labelledby="modifyModalLabel" aria-hidden="true">
		<div class="modal-dialog" style="width: 900px;">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">增加商品</h4>
				</div>
				<div class="modal-body" id="iptBox">
					<form class="form-horizontal form-inline commitForm"
						id="addForm" role="form">
						<table width="100%">
							<tr>
								<td style="text-align: right; width: 12%;">商品名称</td>
								<td><input id="a_goodsName" class="form-control"
									name="goodsName" type="text" value="" style="width: 100%"></td>
								<td style="text-align: right; width: 12%;">商品特色</td>
								<td><input id="a_characterDesc" class="form-control"
									name="characterDesc" type="text" value="" style="width: 100%"></td>
								<td style="text-align: right; width:;"><span>商品状态</span></td>
								<td><select id="a_state" class="form-control" name="state"
									style="width: 100%">
										<option value="0">草稿</option>
										<option value="1">正常</option>
										<option value="2">上架</option>
										<option value="3">缺货</option>
										<option value="4">停售</option>
										<option value="5">删除</option>
								</select></td>
							</tr>
							<tr>
								<td style="text-align: right;"><span>审核状态</span></td>
								<td colspan=""><select id="a_auditStatus"
									class="form-control" name="auditStatus" style="width: 100%">
										<option value="0">审核通过</option>
										<option value="1">审核失败</option>
										<option value="2">未审核</option>
								</select></td>
								<td style="text-align: right;"><span>商品单价</span></td>
								<td colspan=""><input id="a_deliveryLimit"
									class="form-control" name="deliveryLimit" type="text" value=""
									style="width: 100%"></td>
								<td style="text-align: right;"><span>图片</span></td>
								<td colspan=""><input id="a_images" class="form-control"
									name="images" type="text" value="" style="width: 100%">
								</td>
							</tr>
							<tr>
								<td style="text-align: right;"><span>重量</span></td>
								<td colspan=""><input id="a_weight" class="form-control"
									name="weight" type="text" value="" style="width: 100%">
								</td>
								<td style="text-align: right;"><span>是否推荐</span></td>
								<td colspan=""><select id="a_isrec" class="form-control"
									name="isrec" style="width: 100%">
										<option value="0">是</option>
										<option value="1">否</option>
								</select></td>
								<td style="text-align: right;"><span>商品市场价</span></td>
								<td colspan=""><input id="a_marketPrice"
									class="form-control" name="marketPrice" type="text" value=""
									style="width: 100%"></td>
							</tr>
							<tr>
								<td style="text-align: right;"><span>商品运费（分）</span></td>
								<td colspan=""><input id="a_freight" class="form-control"
									name="freight" type="text" value="" style="width: 100%">
								</td>
								<td style="text-align: right;"><span>是否可退货</span></td>
								<td colspan=""><select id="a_returnRule"
									class="form-control" name="returnRule" style="width: 100%">
										<option value="0">是</option>
										<option value="1">否</option>
								</select></td>
								<td style="text-align: right;"><span>是否可换货</span></td>
								<td colspan=""><select id="a_exchangeRule"
									class="form-control" name="exchangeRule" style="width: 100%">
										<option value="0">是</option>
										<option value="1">否</option>
								</select></td>
							</tr>
							<tr>
								<td style="text-align: right;"><span>商品库存</span></td>
								<td colspan=""><input id="a_stock" class="form-control"
									name="stock" type="text" value="" style="width: 100%">
								</td>
								<td style="text-align: right;"><span>描述</span></td>
								<td colspan=""><input id="a_characteristic" class="form-control"
									name="characteristic" type="text" value="" style="width: 100%">
								</td>
							</tr>
							<tr>
							<td style="text-align: right;"><span>品牌</span></td>
								<td colspan=""><input id="a_brand" class="form-control"
									name="brand" type="text" value="" style="width: 100%">
								</td>
								<td style="text-align: right;"><span>商品类型</span></td>
								<td colspan=""><input id="a_goodsType" class="form-control"
									name="goodsType" type="text" value="" style="width: 100%">
								</td>
								<td style="text-align: right;"><span>座位样式</span></td>
								<td colspan=""><input id="a_seatsTyle" class="form-control"
									name="seatsTyle" type="text" value="" style="width: 100%">
								</td>
							</tr>
								<tr>
								<td style="text-align: right;"><span>安装方式</span></td>
								<td colspan=""><input id="a_installWay" class="form-control"
									name="installWay" type="text" value="" style="width: 100%">
								</td>
								<td style="text-align: right;"><span>适用年龄</span></td>
								<td colspan=""><input id="a_suitAge" class="form-control"
									name="suitAge" type="text" value="" style="width: 100%">
								</td>
								<td style="text-align: right;"><span>商品单价</span></td>
								<td colspan=""><input id="a_price" class="form-control"
									name="price" type="text" value="" style="width: 100%">
								</td>
							</tr>
							<tr>
								<td style="text-align: right;"><span>适用体重</span></td>
								<td colspan=""><input id="a_suitWeight" class="form-control"
									name="suitWeight" type="text" value="" style="width: 100%">
								</td>
								<td style="text-align: right;"><span>供货商名称</span></td>
								<td colspan=""><input id="a_supplierName" class="form-control"
									name="supplierName" type="text" value="" style="width: 100%">
								</td>
								<td style="text-align: right;"><span>固定方式</span></td>
								<td colspan=""><input id="a_fixedWay" class="form-control"
									name="fixedWay" type="text" value="" style="width: 100%">
								</td>
							</tr>
							<tr>
								<td style="text-align: right;"><span>供货地代码</span></td>
								<td colspan=""><input id="a_placeoforiginCode" class="form-control"
									name="placeoforiginCode" type="text" value="" style="width: 100%">
								</td>
								<td style="text-align: right;"><span>供货商姓名</span></td>
								<td colspan=""><input id="a_placeoforiginName" class="form-control"
									name="placeoforiginName" type="text" value="" style="width: 100%">
								</td>
							</tr>
						</table>
					</form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">取消
					</button>
					<button type="button" class="btn btn-primary" id="btnSave"
						onclick="add()">增加</button>
				</div>
			</div>
		</div>
	</div>

	<!-- 信息删除确认 -->
	<div class="modal fade" id="delModel">
		<div class="modal-dialog">
			<div class="modal-content message_align">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">×</span>
					</button>
					<h4 class="modal-title">提示信息</h4>
				</div>
				<div class="modal-body">
					<p>您确认要删除吗？</p>
				</div>
				<div class="modal-footer">
					<input type="hidden" id="did" />
					<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
					<a onclick="remove()" class="btn btn-success" data-dismiss="modal">确定</a>
				</div>
			</div>
		</div>
	</div>
</body>

<script type="text/javascript">
	//删除模态框事件监听
	$('#delModel').on('show.bs.modal', function(event) {
		var button = $(event.relatedTarget)
		var gid = button.data('gid')
		var modal = $(this)
		$("#did").val(gid);
	})

	// 修改模态框监听
	$('#modifyModal').on('show.bs.modal', function(event) {
		var button = $(event.relatedTarget)
		var goodsId = button.data('goodsid')
		var goodsName = button.data('goodsname')
		var characterDesc = button.data('characterdesc')
		var state = button.data('state')
		var weight = button.data('weight')
		var stock = button.data('stock')
		var price = button.data('price')
		var marketPrice = button.data('marketprice')
		var modal = $(this)
		modal.find('#m_goodsId').val(goodsId);
		modal.find('#m_goodsName').val(goodsName);
		modal.find('#m_characterDesc').val(characterDesc);
		modal.find('#m_state').val(state);
		modal.find('#m_weight').val(weight);
		modal.find('#m_stock').val(stock);
		modal.find('#m_price').val(price);
		modal.find('#m_marketPrice').val(marketPrice);
	});
</script>
</html>